<template>
  <div class="table">
    <div class="table-head head">
      <el-button class="head-top" type="primary">添加</el-button>
      <div class="head-bottom">
        <SearchInfo @getSearchVal="getSearchVal" @resetSearch="resetSearch"/>
      </div>
    </div>
    <div class="table-content">
      <Table :table-data="tableData" :table-head="infoHead" :table-height-y="100" :total="total"
             @dataInit="getGrouponBusinesses">
        <el-table-column
            label="状态"
            width="80">
          <template slot-scope="scope">
            {{ scope.row.status }}
          </template>
        </el-table-column>
        <el-table-column
            label="操作"
            min-width="200">
          <template slot-scope="scope">
            <el-link type="primary">编辑</el-link>
            <el-link type="primary">禁用</el-link>
            <el-link type="danger">删除</el-link>
          </template>
        </el-table-column>
      </Table>
    </div>

  </div>
</template>

<script>
import {getGrouponBusinesses} from "@/http/api/business"
import {infoHead} from "./table-head"
import Table from "@/components/Table";
import SearchInfo from "@/components/group-business/SearchInfo";

export default {
  name: "GroupBusinessInfo",
  components: {Table, SearchInfo},
  data() {
    return {
      infoHead,
      total: 0,
      tableData: [],
    };
  },
  computed: {},
  methods: {

    //初始化获取数据
    async getGrouponBusinesses() {
      const result = await getGrouponBusinesses({
        pageSize: this.$store.state.pageSize,
        pageNum: this.$store.state.pageNum
      })
      this.tableData = [...result.data.list]
      this.total = result.data.total
    },
    //重置数据
    resetSearch() {
      console.log("重置数据")
    },
    //获取搜索数据
    getSearchVal(searchVal) {
      console.log(searchVal, "@@@@@")
    }
  },
  created() {
  },
  mounted() {
  },
};


</script>

<style lang="scss" scoped>
.table-head {
  height: 100px;
}

.head {
  display: flex;
  flex-direction: column;

  .head-top {
    height: 30px;
    line-height: 30px;
    padding: 0;
    width: 100px;
  }

  .head-bottom {
    flex: 1;
  }
}
</style>
